import { Behaviour } from "./Behaviour";
import { boolean } from "./validators/boolean";
import { string } from "./validators/string";

export class Audio extends Behaviour  {
  @string()
  source = "";
  @boolean()
  IsLoop:boolean=true


    Volume:number=1;
    song
    onStart(){
    this.song = this.engine.resourceManager.getSound(this.source)
    this.song.loop=this.IsLoop;
    //this.song.volume=this.Volume
    }
   ChangeVolume(volume:number){
    this.song.volume=volume
    //console.log(this.song.volume)
   }

    Play(){
        this.song.play();
    }
    Pause(){
        this.song.pause();
    }

}
